package com.google.unizone.timetable;

class HTMLLineParser
{
	private String source;
	private int cursorPosition;

	public HTMLLineParser(String source)
	{
		this.source = source;
		this.source = source.replace("\r", "");
		this.source = source.replace("\n", "");
		this.source = source.toLowerCase();
		this.cursorPosition = 0;
	}

	public String GetNextLine()
	{
		int startIndex, endIndex;

		startIndex = source.indexOf("<tr", this.cursorPosition);
		if(startIndex == -1)
			return null;
		endIndex = source.indexOf("</tr>", startIndex) + "</tr>".length();
		
		cursorPosition = endIndex;
		return source.substring(startIndex, endIndex);
	}
}